package fr.pud.client.model;

import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;

/**
 * A neighbor contains all the sons and the parents of a specific point
 * @author Pierre Reliquet
 */
public class Neighbors {
    /**
     * The sons
     */
    private Collection<Long> sons;
    /**
     * The parents
     */
    private Collection<Long> parents;
    /**
     * The id osm of the current point.
     */
    private long             point;

    /**
     * Default constructor.
     * @param p
     *            the point.
     */
    public Neighbors(long p) {
        this.point = p;
        this.sons = new LinkedList<Long>();
        this.parents = new LinkedList<Long>();
    }

    /**
     * @param p
     *            the point.
     * @param sons
     *            its sons.
     * @param parents
     *            its parents.
     */
    public Neighbors(long p, HashSet<Long> sons, HashSet<Long> parents) {
        this.point = p;
        this.sons = sons;
        this.parents = parents;
    }

    /**
     * @return the parents.
     */
    public Collection<Long> getParents() {
        return this.parents;
    }

    /**
     * @return the point
     */
    public long getPoint() {
        return this.point;
    }

    /**
     * @return the sons.
     */
    public Collection<Long> getSons() {
        return this.sons;
    }

    @Override
    public String toString() {
        return "Point " + this.point + "having " + this.sons.size()
                + " sons and " + this.parents.size() + "parents";
    }
}
